import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;


public class Delegat 
{
	
	BufferedReader tastatura=new BufferedReader(new InputStreamReader(System.in));
	List<Obiect> lista=new ArrayList<Obiect>();
	
	public void adaugaMarfa() throws IOException
	{
		System.out.println("Nume:");
		String nume=tastatura.readLine();
		System.out.println("Cod:");
		int cod=Integer.parseInt(tastatura.readLine());
		System.out.println("Pret:");
		int pret=Integer.parseInt(tastatura.readLine());
		System.out.println("Cantitate:");
		int cantitate=Integer.parseInt(tastatura.readLine());
		lista.add(new Obiect(nume, cod, pret, cantitate));
	}
	
	@SuppressWarnings("rawtypes")
	public void suprimaMarfa() throws NumberFormatException, IOException
	{
		System.out.println("Introduceti codul produsului pt stergere:");
		int cod_suprimat=Integer.parseInt(tastatura.readLine());
		
		//lista.remove(cod_suprimat);
		ListIterator it=lista.listIterator();
		while(it.hasNext()){
			if (it.equals(cod_suprimat))
				{it.remove();
				//break;
				}
			break;
		}
		//it.remove(cod_suprimat);
	}
	
	@SuppressWarnings("rawtypes")
	public void afisareMarfa()
	{
		ListIterator it=lista.listIterator();
		while(it.hasNext())
			System.out.println(it.next());
	}
}


